package com.fpx.open.platform.domain;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

import com.fasterxml.jackson.annotation.JsonIgnore;

/**
 * 应用类 
 * 
 * @author sunkey
 * @date Apr 27, 2013 2:50:15 PM
 * @version 1.0.0
 */
@XmlRootElement
public class Application extends ParentDomain implements Serializable {
	
	public static final String TYPE_AUTHORITH = "AUTHORITH";
	
	public static final String TYPE_OMS = "OMS";
	
	public static final String TYPE_XMS = "XMS";

	/**
	 * appId,测试用
	 */
	public static final int APP_TEST = 999;
	/**
	 * appId,客户授权于API的平台用户
	 */
	public static final int APP_AUTHORITH = 1000;
	/**
	 * appId,注册物流帐户,适用于API的平台用户
	 */
	public static final int APP_REGISTER = 1001;

	/**
	 * appId, 邮件发送
	 */
	public static final int APP_EMAIL = 1002;
	
	/**
	 * appId,物流系统,这个暂时的通用方式，可以细分
	 */
	public static final int APP_XMS = 1003;
	/**
	 * appId,订单宝系统
	 */
	public static final int APP_OMS = 1004;
	
	/**
	 * appId,国内仓储系统
	 */
	public static final int APP_WMC = 1007;
	/**
	 * 订单变动功能
	 */
	public static final int APP_XMS_ORDERCHANGE=1008;
	
	/**
	 * ODA地址校验
	 */
	public static final int APP_XMS_ODA = 1009;
	
	/**
	 * appId,公司分拨点
	 */
    public static final Integer APP_XMS_COMP = 1010;
    
	/**
	 * 平台用户管理
	 */
    public static final Integer APP_FOP_USER_MANAGER = 9999;
    
    public static final List<Integer> XMS_APP = new ArrayList<Integer>();
    
    public static final List<Integer> OMS_APP = new ArrayList<Integer>();
    
    static {
        XMS_APP.add(APP_XMS);
        XMS_APP.add(APP_XMS_ORDERCHANGE);
        XMS_APP.add(APP_XMS_ODA);
        XMS_APP.add(APP_XMS_COMP);
        XMS_APP.add(APP_AUTHORITH);
        XMS_APP.add(APP_REGISTER);
        
        OMS_APP.add(APP_OMS);
        OMS_APP.add(APP_XMS_COMP);
        OMS_APP.add(APP_XMS_ODA);
        OMS_APP.add(APP_WMC);
        OMS_APP.add(APP_AUTHORITH);
        OMS_APP.add(APP_REGISTER);
    }
    
    private Integer appId;

    private Integer status;

    private String type;

    private Integer visibility;

    private String name;

    private String enName;

    private String remark;

    private static final long serialVersionUID = 1L;

    public Integer getAppId() {
        return appId;
    }

    public void setAppId(Integer appId) {
        this.appId = appId;
    }

    @XmlTransient
    @JsonIgnore
    public Integer getStatus() {
        return status;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }

    @XmlTransient
    @JsonIgnore
    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type == null ? null : type.trim();
    }

    @XmlTransient
    @JsonIgnore
    public Integer getVisibility() {
        return visibility;
    }

    public void setVisibility(Integer visibility) {
        this.visibility = visibility ;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name == null ? null : name.trim();
    }

    public String getEnName() {
        return enName;
    }

    public void setEnName(String enName) {
        this.enName = enName == null ? null : enName.trim();
    }

    @XmlTransient
    @JsonIgnore
    public String getRemark() {
        return remark;
    }

    public void setRemark(String remark) {
        this.remark = remark == null ? null : remark.trim();
    }

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        Application other = (Application) that;
        return (this.getAppId() == null ? other.getAppId() == null : this.getAppId().equals(other.getAppId()))
            && (this.getStatus() == null ? other.getStatus() == null : this.getStatus().equals(other.getStatus()))
            && (this.getType() == null ? other.getType() == null : this.getType().equals(other.getType()))
            && (this.getVisibility() == null ? other.getVisibility() == null : this.getVisibility().equals(other.getVisibility()))
            && (this.getName() == null ? other.getName() == null : this.getName().equals(other.getName()))
            && (this.getEnName() == null ? other.getEnName() == null : this.getEnName().equals(other.getEnName()))
            && (this.getRemark() == null ? other.getRemark() == null : this.getRemark().equals(other.getRemark()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getAppId() == null) ? 0 : getAppId().hashCode());
        result = prime * result + ((getStatus() == null) ? 0 : getStatus().hashCode());
        result = prime * result + ((getType() == null) ? 0 : getType().hashCode());
        result = prime * result + ((getVisibility() == null) ? 0 : getVisibility().hashCode());
        result = prime * result + ((getName() == null) ? 0 : getName().hashCode());
        result = prime * result + ((getEnName() == null) ? 0 : getEnName().hashCode());
        result = prime * result + ((getRemark() == null) ? 0 : getRemark().hashCode());
        return result;
    }
    
    
    
    
    public static void main(String[]  args){
    	
    	System.out.println("hello!");
    }
}